package org.okcjug.december.map;

import java.util.HashMap;

import junit.framework.TestCase;


public class MyHashMap extends TestCase
{
	private HashMap<String, String> myHash;
	
	public void test_some()
	{
		myHash = new HashMap<String, String>();
		myHash.put("C", "1");
		myHash.put("A", "3");
		myHash.put("B", "2");
		
		assertTrue("expect myHash to contain the key A", myHash.containsKey("A"));
		
		System.err.println("key values: " + myHash.keySet()); // it's ordered
		
		System.err.println("values: " + myHash.values()); // ordered by key value
		
		// how do I iterate over a HashMap?
		
		
		
			

		
//		Set<String> keySet = myHash.keySet();
//		
//		for (Iterator<String> iterator = keySet.iterator(); iterator.hasNext();) {
//			String string = (String) iterator.next();
//			System.err.println("Key: " + string);
//		}
		
		
		
		
		
		//Well bs, if you want to access the both the key and value...
//		for(Entry<String, String> entry : myHash.entrySet()){
//			System.err.println("Key: " + entry.getKey() + "  Value: " + entry.getValue());
//		}
		
		
		
	}
}
